#include "Primitives.h"

Rectangle::Rectangle(GLdouble x, GLdouble y, GLdouble z){
	this->x = x;
	this->y = y;
	this->z = z;
	centerBS = new Vector3();
}

void Rectangle::boundingSphere(Matrix4 *c, Texture *t){
	radiusBS = sqrt(x*x/4 + y*y/4 + z*z/4);
	float *m = (float*)malloc(sizeof(float)*16);
	m = c->get();
	centerBS->set(m[12], m[13], m[14]);	
	this->t = t;

	free(m);
/*	glPushMatrix();		
		glLoadIdentity();
		glTranslatef((*centerBS)[0], (*centerBS)[1], (*centerBS)[2]);
		glutWireSphere(radiusBS, 6,6);
	glPopMatrix();*/
}

void Rectangle::render(){
	glPushMatrix();
		glScaled(x, y, z);
		glutSolidCube(1);
	glPopMatrix();
}



